package com.viking.utils;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;

import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.DocumentHelper;
import org.dom4j.io.SAXReader;

public class DocumentUtil {

	public static org.w3c.dom.Document toW3CDocument(org.dom4j.Document d4doc)
			throws DocumentException {
		org.dom4j.io.DOMWriter d4Writer = new org.dom4j.io.DOMWriter();
		return d4Writer.write(d4doc);
	}

	public static Document getDocument(String docStr) throws DocumentException {
		Document doc = null;
		doc = DocumentHelper.parseText(docStr);
		return doc;
	}

	public static Document getDocumentEl() throws DocumentException {
		File xmlFile = new File("F:\\backMessage.txt");
		SAXReader reader = new SAXReader();
		Document doc = reader.read(xmlFile);
		return doc;
	}
}
